<div class="form-group clearfix">
  <div class="form-inline pull-left">
    <button type="button" class="btn btn-default" routerLink="addTemp">新增模板</button>
  </div>
  <div class="form-inline pull-right">
    <input class="form-control" placeholder="模板名称" name="title" [(ngModel)]="searchData">
    <button class="btn btn-default" (click)="search()">搜索</button>
    <button class="btn btn-default" (click)="reset()">重置</button>
  </div>
</div>

<div>
  <table class="table">
    <thead>
    <tr>
      <th>id</th>
      <th>微信关联模板ID</th>
      <th>模板名称</th>
      <th>模板类型</th>
      <th>模板描述</th>
      <th>是否默认</th>
      <th>创建时间</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>
      <tr *ngFor="let item of tableData">
        <td>{{item.id}}</td>
        <td>{{item.wx_template_id}}</td>
        <td>{{item.name}}</td>
        <td>{{item.template_category?.name}}</td>
        <td>{{item.describe}}</td>
        <td>{{!!item.is_default?'是':'否'}}</td>
        <td>{{item.created_at}}</td>
        <td>
          <a href="javascript:;" routerLink="editTemp/{{item.id}}">编辑</a>-
          <a href="javascript:;" (click)="delTemp(item.id)">删除</a>
        </td>
      </tr>
    </tbody>
  </table>
  <div class="text-center">
    <pagination (pageChanged)="pageChanged($event)" [totalItems]="totalItems" [itemsPerPage]="itemsPerPage" [(ngModel)]="currentPage"
                previousText="&lsaquo;" nextText="&rsaquo;" firstText="&laquo;" lastText="&raquo;" [boundaryLinks]="true" class="pagination-sm"></pagination>
  </div>
</div>

<app-notification [type]="type" [message]="message" [isShow]="isShow" (promptIsShow)="promptIsShow($event)"></app-notification>
<div class="modal fade" bsModal #deleteModal="bs-modal" tabindex="-1">
  <div class="modal-dialog modal-md">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title pull-left">确认</h4>
        <button type="button" class="close pull-right" aria-label="Close" (click)="deleteModal.hide()">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body text-center">
        <p>确定删除吗？</p>
        <div class="text-right mt20">
          <button class="btn btn-default btn-md-long" type="button" (click)="deleteModal.hide()">取消</button>
          <button class="btn btn-success btn-md-long" type="button" (click)="delTempSubmit()">确定</button>
        </div>
      </div>
    </div>
  </div>
</div>
